package com.lagou.service.impl;

import com.lagou.HelloService;
import org.apache.dubbo.config.annotation.Service;

import java.util.Random;

/**
 * @ClassName: HelloServiceImpl
 * @Auther: Jerry
 * @Date: 2020/10/19 9:07
 * @Desctiption: 提供3个方法，每个方法都实现随机休眠0-100ms
 * @Version: 1.0
 */
@Service
public class HelloServiceImpl implements HelloService {
    @Override
    public String sayHello(String name) {
        try {
            Thread.sleep(new Random().nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "hello," + name;
    }

    @Override
    public String sayWorld(String name) {
        try {
            Thread.sleep(new Random().nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "world," + name;
    }

    @Override
    public String sayGoodbye(String name) {
        try {
            Thread.sleep(new Random().nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "goodbye," + name;
    }
}
